<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/home', 'HomeController@index');
//前台用户认证
Route::get('login', 'Auth\AuthController@showLoginForm');
Route::post('login', 'Auth\AuthController@login');
Route::get('logout', 'Auth\AuthController@logout');

// Registration Routes...   关闭注册功能
//Route::get('register', 'Auth\AuthController@showRegistrationForm');
//Route::post('register', 'Auth\AuthController@register');

// Password Reset Routes...
//Route::get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
//Route::post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
//Route::post('password/reset', 'Auth\PasswordController@reset');


//后台用户认证
Route::group(['namespace' => 'Admin'], function(){
    Route::group(['prefix' => '/admin'], function(){
        Route::get('/login', 'AuthController@getLogin');
        Route::post('/login', 'AuthController@postLogin');
        Route::get('/logout', 'AuthController@logout');
//        Route::get('/register', 'AuthController@getRegister');
//        Route::post('/register', 'AuthController@postRegister');
        Route::get('/', 'AdminController@index');
        
        Route::get('/survey', 'SurveyController@index');    //展示问卷调查列表
        Route::get('/survey/{id}', 'SurveyController@detail');  //问卷调查详情页
        Route::get('/survey/chart/{id}', 'SurveyController@chart'); //问卷统计图表页

        //员工管理
        Route::group(['prefix' => '/staff'], function(){
            Route::get('/', 'StaffController@index');   //员工管理首页
        });

    });
    
    //后台api
    Route::group(['prefix' => '/api'], function(){
        Route::post('/addSurvey', 'ApiController@addSurvey');   //添加调查问卷
        Route::post('/editSurvey', 'ApiController@editSurvey'); //编辑调查问卷
        Route::post('/addQuestion', 'ApiController@addQuestion');   //添加提问
        Route::post('/deleteQuestion', 'ApiController@deleteQuestion');   //删除提问
        Route::post('/deleteSurvey', 'ApiController@deleteSurvey');   //删除问卷
        Route::post('/copySurvey', 'ApiController@copySurvey');   //复制问卷
        Route::post('/addStaff', 'ApiController@addStaff');   //添加员工
        Route::post('/resetPassword', 'ApiController@resetPassword');   //重置密码
        Route::post('/deleteUser', 'ApiController@deleteUser');   //重置密码
        Route::post('/getUserInfo', 'ApiController@getUserInfo');   //得到用户信息
        Route::post('/editUserInfo', 'ApiController@editUserInfo');   //得到用户信息
    });
});

//员工满意度调查问卷
Route::group(['namespace' => 'Vote', 'prefix' => '/staff'], function(){
    Route::get('index/{id}', 'StaffController@index');
    Route::get('survey/{id}', 'StaffController@survey');
    Route::post('submit', 'StaffController@submit');
});
